//
//  AboutScene.cpp
//  petgame
//
//  Created by zz on 2018/12/16.
//

#include "AboutScene.hpp"


Scene*AboutScene::createScene(){
    
    auto scene=Scene::create();
    auto layer=AboutScene::create();
    scene->addChild(layer);
    return scene;
    
    
}
AboutScene* AboutScene::create(){
    
    auto aboutscene=new AboutScene();
    if(aboutscene&&aboutscene->init()){
        
        aboutscene->autorelease();
        return aboutscene;
    }else{
        
        CC_SAFE_DELETE(aboutscene);
        return NULL;
    }
}
bool AboutScene::init(){
    
    if(!Layer::init()){
        
        return false;
    }
    
    auto size=Director::getInstance()->getVisibleSize();
    auto bg=Sprite::create("mmbg.jpg");
    bg->setScale(0.5);
    bg->setPosition(size/2);
    this->addChild(bg);
    
    auto backbtn=MenuItemImage::create("gg4.png","gg4s.png",CC_CALLBACK_1(AboutScene::back, this));
    backbtn->setPosition(Vec2(20,size.height-20));
    backbtn->setScale(0.4);
    auto menu=Menu::create(backbtn,NULL);
    menu->setPosition(Vec2::ZERO);
    this->addChild(menu);
    
    
    auto infos=Sprite::create("infos.png");
    infos->setPosition(size/2);
    this->addChild(infos);
    
    return true;
}
void AboutScene::back(Ref*psender){
    
    Director::getInstance()->replaceScene(HelloWorld::createScene());
    
}



